<template>
  <div class="newsinfo">
    <div class="newsDetail"
      v-html="newsinfo[id - 1].newsDetail"
      v-if="newsinfo[id - 1]"
      >
    </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  props: ['id'],
  data() {
    return {
      newsinfo: [],
      txtData: []
    }
  },
  created() {
    // console.log(this.$route.params.id)
    this.getnewsInfo()
  },
  methods: {
    async getnewsInfo() {
      const res = await axios.get('http://localhost:3000/news')
      this.newsinfo = res.data
    }
  }
}
</script>

<style>
.newsinfo {
  padding: 0 19px;
}
</style>